package com.example.myapplication.RoomFile

import android.content.Context
import androidx.room.Database
import androidx.room.DatabaseConfiguration
import androidx.room.InvalidationTracker
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.sqlite.db.SupportSQLiteOpenHelper
@Database(entities = [Word::class], version = 1, exportSchema = false)
abstract class WordDatabase: RoomDatabase() {
    public abstract fun wordDao(): WordDao

    companion object{
        var instance: WordDatabase? = null
        fun getInstance(context: Context): WordDatabase{
            if (instance == null){
                instance = Room.databaseBuilder(context.applicationContext,WordDatabase::class.java,"word_database").allowMainThreadQueries().build()
            }
            return  instance!!
        }
    }
}